When you look at meeting room properties in Outlook 2010, you can see 'City', 'Country/Region' and 'Department' information.
Is there any way to get this information using EWS Java API?
Technology Tips and News
When you look at meeting room properties in Outlook 2010, you can see 'City', 'Country/Region' and 'Department' information.
Is there any way to get this information using EWS Java API?
You need to use the ResolveName operation and specify to return the Contact information from Active Directory in the Java EWS api you should be able to use the resolveName Method from the ExchangeService class eg something like
NameResolutionCollection nameResolutions = service.resolveName("Meeting Room 1",ResolveNameSearchLocation.DirectoryOnly, true); System.out.println("nameResolutions==="+nameResolutions.getCount()); for(NameResolution nameResolution : nameResolutions) { System.out.println("NAME==="+nameResolution.getContact().getName()); }
You should then be able to get what you want from the Contact object
Cheers
Glen
You need to use the ResolveName operation and specify to return the Contact information from Active Directory in the Java EWS api you should be able to use the resolveName Method from the ExchangeService class eg something like
NameResolutionCollection nameResolutions = service.resolveName("Meeting Room 1",ResolveNameSearchLocation.DirectoryOnly, true); System.out.println("nameResolutions==="+nameResolutions.getCount()); for(NameResolution nameResolution : nameResolutions) { System.out.println("NAME==="+nameResolution.getContact().getName()); }
You should then be able to get what you want from the Contact object
Cheers
Glen
You need to use the ResolveName operation and specify to return the Contact information from Active Directory in the Java EWS api you should be able to use the resolveName Method from the ExchangeService class eg something like
NameResolutionCollection nameResolutions = service.resolveName("Meeting Room 1",ResolveNameSearchLocation.DirectoryOnly, true); System.out.println("nameResolutions==="+nameResolutions.getCount()); for(NameResolution nameResolution : nameResolutions) { System.out.println("NAME==="+nameResolution.getContact().getName()); }
You should then be able to get what you want from the Contact object
Cheers
Glen
Many thanks for help.
I was able to get the necessary information from Contact.
Hi Glen,
Thanks for giving this code...With this code, i am able to fetch the name of the meeting rooms available.But i want to know, how to get the appointment of the particular room like what time rooms are booked along with date. Can, you please help me in it. I am using ews-java api
Thanks,
Akshea
There are two ways you could do that just use FindItem to query the Calendar Folder involved see "Get all appointments between startDate and endDate in the specified folder, including recurring meeting occurrences" in https://github.com/OfficeDev/ews-java-api
The other method you could use if you have multiple mailboxes you want to do this on is use the FreeBusy time via GetUserAvailabilty see the "Availability Service" section in the above link
Cheers
Glen
Hi Glen,
I am able to understand what u have said, but do not know how to implement it with meeting rooms....
If i am implementing "Get all appointments between startDate and endDate in the specified folder, including recurring meeting occurrences" in ews-java-api, as you have mentioned above, i am able to get only my appointments from the start date to end date , as i have given my email id and password, how to get my organization meeting room details, booked or not.
static ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); public static void main(String[] args) throws Exception { // TODO Auto-generated method stub ExchangeCredentials credentials = new WebCredentials("xxx@yy.com", "zzzz"); service.setCredentials(credentials); try { System.out.println("Check"); service.autodiscoverUrl("xxx@yy.com",new RedirectionUrlCallback()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } NameResolutionCollection nameResolutions = service.resolveName("SDB1",ResolveNameSearchLocation.DirectoryOnly, true); System.out.println("nameResolutions==="+nameResolutions.getCount()); for(NameResolution nameResolution : nameResolutions) { System.out.println("NAME==="+nameResolution.getContact().getDisplayName()); } }
The above code gives me the output like, the meeting room in my organization with word SDB1 are
Output:
nameResolutions===2
NAME===SDB1- TELCON - 1
NAME===SDB1-TELCON - 2
for. eg. I need to know today at what are the appointments in the room SDB1-TELCON2 and who all have booked the room.
I do not know how to implement for the meeting room can you please help me how to give it.
Thanks in advance.
Hi Glen,
I am able to understand what u have said, but do not know how to implement it with meeting rooms....
If i am implementing "Get all appointments between startDate and endDate in the specified folder, including recurring meeting occurrences" in ews-java-api, as you have mentioned above, i am able to get only my appointments from the start date to end date , as i have given my email id and password, how to get my organization meeting room details, booked or not.
static ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); public static void main(String[] args) throws Exception { // TODO Auto-generated method stub ExchangeCredentials credentials = new WebCredentials("xxx@yy.com", "zzzz"); service.setCredentials(credentials); try { System.out.println("Check"); service.autodiscoverUrl("xxx@yy.com",new RedirectionUrlCallback()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } NameResolutionCollection nameResolutions = service.resolveName("SDB1",ResolveNameSearchLocation.DirectoryOnly, true); System.out.println("nameResolutions==="+nameResolutions.getCount()); for(NameResolution nameResolution : nameResolutions) { System.out.println("NAME==="+nameResolution.getContact().getDisplayName()); } }
The above code gives me the output like, the meeting room in my organization with word SDB1 are
Output:
nameResolutions===2
NAME===SDB1- TELCON - 1
NAME===SDB1-TELCON - 2
for. eg. I need to know today at what are the appointments in the room SDB1-TELCON2 and who all have booked the room.
I do not know how to implement for the meeting room can you please help me how to give it.
Thanks in advance.
Hi Glen,
I am able to understand what u have said, but do not know how to implement it with meeting rooms....
If i am implementing "Get all appointments between startDate and endDate in the specified folder, including recurring meeting occurrences" in ews-java-api, as you have mentioned above, i am able to get only my appointments from the start date to end date , as i have given my email id and password, how to get my organization meeting room details, booked or not.
static ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); public static void main(String[] args) throws Exception { // TODO Auto-generated method stub ExchangeCredentials credentials = new WebCredentials("xxx@yy.com", "zzzz"); service.setCredentials(credentials); try { System.out.println("Check"); service.autodiscoverUrl("xxx@yy.com",new RedirectionUrlCallback()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } NameResolutionCollection nameResolutions = service.resolveName("SDB1",ResolveNameSearchLocation.DirectoryOnly, true); System.out.println("nameResolutions==="+nameResolutions.getCount()); for(NameResolution nameResolution : nameResolutions) { System.out.println("NAME==="+nameResolution.getContact().getDisplayName()); } }
The above code gives me the output like, the meeting room in my organization with word SDB1 are
Output:
nameResolutions===2
NAME===SDB1- TELCON - 1
NAME===SDB1-TELCON - 2
for. eg. I need to know today at what are the appointments in the room SDB1-TELCON2 and who all have booked the room.
I do not know how to implement for the meeting room can you please help me how to give it.
Thanks in advance.
Hi Glen,
I am able to understand what u have said, but do not know how to implement it with meeting rooms....
If i am implementing "Get all appointments between startDate and endDate in the specified folder, including recurring meeting occurrences" in ews-java-api, as you have mentioned above, i am able to get only my appointments from the start date to end date , as i have given my email id and password, how to get my organization meeting room details, booked or not.
static ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); public static void main(String[] args) throws Exception { // TODO Auto-generated method stub ExchangeCredentials credentials = new WebCredentials("xxx@yy.com", "zzzz"); service.setCredentials(credentials); try { System.out.println("Check"); service.autodiscoverUrl("xxx@yy.com",new RedirectionUrlCallback()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } NameResolutionCollection nameResolutions = service.resolveName("SDB1",ResolveNameSearchLocation.DirectoryOnly, true); System.out.println("nameResolutions==="+nameResolutions.getCount()); for(NameResolution nameResolution : nameResolutions) { System.out.println("NAME==="+nameResolution.getContact().getDisplayName()); } }
The above code gives me the output like, the meeting room in my organization with word SDB1 are
Output:
nameResolutions===2
NAME===SDB1- TELCON - 1
NAME===SDB1-TELCON - 2
for. eg. I need to know today at what are the appointments in the room SDB1-TELCON2 and who all have booked the room.
I do not know how to implement for the meeting room can you please help me how to give it.
Thanks in advance.
>i am able to get only my appointments from the start date to end date , as i have given my email id and password, how to get my organization meeting room details, booked or not.
You use exactly the same code but all you need to do is use FolderId class overload to specify Mailbox you want to access eg
FolderId Calendar = new FolderId(WellKnownFolderName.Calendar, "Mailbox@domain"); service.FindAppointments(Calendar,.....Cheers
Hi Glen,
Thanks, for your response....
What is that Mailbox@domain ? Is it the meeting room email id?
Is it like my meeting room email id? SDB1-TELCON2@yy.com?
Hi Glen,
Along with the previous code mentioned, i have added the below code to get meeting room appointment, but it throws the following exception.
Exception in thread "main" microsoft.exchange.webservices.data.ServiceResponseException: The specified folder could not be found in the store. at microsoft.exchange.webservices.data.ServiceResponse.internalThrowIfNecessary(ServiceResponse.java:262) at microsoft.exchange.webservices.data.ServiceResponse.throwIfNecessary(ServiceResponse.java:251) at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:146) at microsoft.exchange.webservices.data.ExchangeService.findItems(ExchangeService.java:807) at microsoft.exchange.webservices.data.ExchangeService.findAppointments(ExchangeService.java:1089) at com.hcl.GetRoomClass.main(GetRoomClass.java:58)
Here is my code:
Date startDate = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(startDate); cal.add(Calendar.DATE, 30); // add 10 days Date endDate = cal.getTime(); Mailbox meetingMailbox = new Mailbox("SDB1-TELCON2@yy.com"); FolderId CalendarId = new FolderId(WellKnownFolderName.Calendar, meetingMailbox); CalendarView cView = new CalendarView(startDate, endDate); FindItemsResults<Appointment> appointments = service.findAppointments(CalendarId, cView); for (Appointment a : appointments) { System.out.println("Subject: " + a.getSubject().toString() + " "); System.out.println("Start: " + a.getStart().toString() + " "); System.out.println("End: " + a.getEnd().toString()); System.out.println(); }
What is the problem? Am i not able to access the meeting room calendar.
HI glen,
Can you please help in below exception caused
That error mean you don't have rights to the Mailbox Folder in question you need to grant the rights via either Add-MailboxPermission or Add-MailboxFolderPermission or use EWS Impersonation (Note you need to be able to open the Calendar folder in outlook using whatever user you running the code as, Admin rights mean nothing).
Cheers
Glen
Hi Glen,
Can i get any sample how to grant the rights via Add-Mailbox Permission using ews java api.....I am not having admin rights to use Impersonation. Please help me.
Thanks in advance
Hi Glen,
can you please help me in it.